#include "process.h"

void ProncessOn() //函数定义
{
    int count = 0;
    char bar[NUM];
    memset(bar, '\0', sizeof(bar));

    //reserve
    const char* lable = "|/-\\";

    // 进度条样式
    char style[S_NUM] = {'+', '#', '>', '-', '.'};
    while(count <= 100)
    {
        printf("\033[42;34m[%-100s][%d%%][%c]\033[0m\r", bar, count, lable[count%4]);  //%-s向左对齐
        fflush(stdout);
        bar[count++] = style[N];
        //sleep(1); //sleep参数的单位为秒，休眠时间太长
        usleep(50000);    //usleep参数的单位为微妙
    }
    printf("\n");
}
